<script src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>
<div class="module clearfix">
	
<?php if(!$profile['info']){?>
<div class="module clearfix">
<h2>ARTICLES</h2>
	<div class="padding-bo
	<div class="padding-bottom margin-bottom  border-bottom">
	</div>

</div>
	
	<div class='alert alert-warning'>
		Opps! You are not allow to add articles please fill up your
		profile....

		

	</div>



	<?php } else { ?>
	<?php 
	if($mode== "ADD"){

		?>
<h2><?php 
	if($profile['info']->title){
	?><?= $profile['info']->title;?>
	<?php }?>
	</h2>
	<div class="padding-bottom margin-bottom  border-bottom">
	</div>
		
	<div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<span class="glyphicon glyphicon-random"></span> &nbsp;Article
					Maintanence
				</h3>
			</div>
			<div class="panel-body">

				<div class="col-xs-12 clearfix">
					<input type="hidden" name="profile_id" value="<?= $profile_id; ?> ">

					<?php if($this->session->flashdata('message')) { 
						$show_message = $this->session->flashdata('message'); ?>
					<h5 class="login-text text-danger">
						<?= $show_message; ?>
					</h5>
					<?php } ?>
					<form class="form-horizontal" role="form" method="post"
						action="<?= base_url();?>member/article/submit_article">
						<div class="form-group">
							<label class="col-sm-3 control-label">Title</label>
							<div class="col-sm-9">
								<small class="login_password-text text-danger"> <?php echo form_error('article_title'); ?>
								</small> <input type="institute" name="article_title"
									class="form-control" placeholder="Title">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Description</label>
							<div class="col-sm-9">
								<small class="login_password-text text-danger"> <?php echo form_error('article_description'); ?>
								</small>
								<textarea class="form-control" cols="5" rows="4"
									style="height: auto;" name="article_description">
									
									</textarea>
									 <script
									type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'article_description',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
							</div>
						</div>
						
		<!-- <div class="form-group">
		<label class="col-sm-3 control-label">Description</label>
		
		<div class="col-sm-9" style="padding: 10px 0 0;">
			<textarea class="wysihtml5 form-control" name="desc" id="wysihtml5" style="height: auto;" rows="5"></textarea>

		</div>
	</div>
	 -->
	
						<hr>
<div class="form-group">
							<label class="col-sm-3 control-label">Meta Title</label>
							<div class="col-sm-9">
								<input type="institute" name="meta_title"
									class="form-control" placeholder="Meta Title">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Meta Keyword</label>
							<div class="col-sm-9">
								 <input type="institute" name="meta_keyword"
									class="form-control" placeholder="Meta Keyword">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Meta Description</label>
							<div class="col-sm-9">
								<textarea class="form-control" cols="5" rows="2"
									style="height: auto;" name="meta_description">
									 
									</textarea>
							</div>
						</div>
						
						<div class="form-group">
							<div class="col-sm-offset-3 col-sm-9">
								<button type="submit" class="btn btn-info">Add Article</button>

								<!-- <a class="btn btn-success" href="<?= base_url();?>member/awards">Next</a> -->

							</div>
						</div>
					</form>
				</div>

			</div>



			<table class="table table-hover">

				<thead>
					<tr>

						<th>Title</th>
						<th>Description</th>
						<th>Action</th>
					</tr>
				</thead>
				<tbody>
				<?php if($article['details']){?>
<?php foreach($article['details'] as $article):?>
					<tr>

						<td><?= substr($article->title,0,30);?></td>
						<td><?= substr($article->description,0,50);?></td>
						
						<th><a data-toggle="tooltip" title="Edit" href="<?= base_url();?>member/article/edit/<?= $article->id;?>"
							class="btn btn-default btn-xs"><span
								class="glyphicon glyphicon-pencil"></span> </a> <a
							data-toggle="tooltip" title="Delete" href="<?= base_url();?>member/article/delete/<?= $article->id;?>"
							class="btn btn-default btn-xs"><span
								class="glyphicon glyphicon-trash"></span> </a></th>


					</tr>
<?php endforeach;?>
<?php }?>
				</tbody>
			</table>

			<div class="panel-body">

				<div class="col-xs-9 clearfix"></div>

			</div>

		</div>


	</div>
	
	
	<?php }?>

	<?php }?>
	<?php 
	if($mode=="EDIT"){
		?>

	<div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<span class="glyphicon glyphicon-random"></span> &nbsp;Article
					Maintanence
					<div class="badge pull-right">
						<a class="text text-success"
							href="<?= base_url();?>member/article">BACK</a>
					</div>
				</h3>

			</div>
			<div class="panel-body">

				<div class="col-xs-12 clearfix">
					<?php if($this->session->flashdata('message')) { 
						$show_message = $this->session->flashdata('message'); ?>
					<h5 class="login-text text-danger">
						<?= $show_message; ?>
					</h5>
					<?php } ?>
					<form class="form-horizontal" role="form" method="post"
						action="<?= base_url();?>member/article/update_article">
						<div class="form-group">
							<label class="col-sm-3 control-label">Title</label>
							<div class="col-sm-9">
								<small class="login_password-text text-danger"> <?php echo form_error('article_title'); ?>
								</small> <input type="institute" name="article_title"
									class="form-control" value="<?= $article['info']->title;?>">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Description</label>
							<div class="col-sm-9">
								<small class="login_password-text text-danger"> <?php echo form_error('article_description'); ?>
								</small>
								<textarea class="form-control" cols="5" rows="4"
									style="height: auto;" name="article_description">
									<?= $article['info']->description;?>
									</textarea>
									 <script
									type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'article_description',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
							</div>
						</div>
						
		<!-- <div class="form-group">
		<label class="col-sm-3 control-label">Description</label>
		
		<div class="col-sm-9" style="padding: 10px 0 0;">
			<textarea class="wysihtml5 form-control" name="desc" id="wysihtml5" style="height: auto;" rows="5"></textarea>

		</div>
	</div>
	 -->
	
						<hr>
<div class="form-group">
							<label class="col-sm-3 control-label">Meta Title</label>
							<div class="col-sm-9">
								<input type="institute" name="meta_title"
									class="form-control" value="<?= $article['info']->meta_title;?>">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Meta Keyword</label>
							<div class="col-sm-9">
								 <input type="institute" name="meta_keyword"
									class="form-control" value="<?= $article['info']->meta_keyword;?>">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Meta Description</label>
							<div class="col-sm-9">
								<textarea class="form-control" cols="5" rows="2"
									style="height: auto;" name="meta_description">
									 <?= $article['info']->meta_description;?>
									</textarea>
							</div>
						</div>
						
						<div class="form-group">
							<div class="col-sm-offset-3 col-sm-9">
								<input type="hidden" name="id"
									value="<?= $article['info']->id;?>">
								<button type="submit" class="btn btn-info">Update Article</button>
							</div>
						</div>
					</form>
				</div>

			</div>
		</div>
	</div>

	<?php }?>

</div>
